function fn1(){
    const a=3;
   return function fn2(){
        return a
    }
} 
console.log('test-fn1',fn1()())


function fn(){
    let a=3;
    function fn2(){
        a++;
        return a
    }
    return fn2()
}
const closeureFn=fn();
console.log(closeureFn)
const people=[{
    firstname:"aaFirstname",lastname:"cclastName",
},{
    firstname:'ccFirstname',lastname:"aalastName"
}]
const sortBy=(pro)=>{
    return (a,b)=>{
        const result=(a[pro]<b[pro])?-1:(a[pro]>b[pro]?1:0);
        return result
    }
}
console.log(people.sort(sortBy('firstname')));